﻿Imports Entities
Public Class DetallePedidoDAL
    Public Shared Function Create(ByVal zObject As DETALLEPEDIDO) As DETALLEPEDIDO
        Try
            Using bd As New gas_gasdesuvecinoEntities
                bd.DETALLEPEDIDO.Add(zObject)
                bd.SaveChanges()
                Return zObject
            End Using
        Catch ex As Exception
            Debug.Print("DetallePedidoDAL.Create() " + ex.Message)
            Return Nothing
        End Try
    End Function
    Public Shared Function ListByPedido(ByVal zId As Long) As List(Of DETALLEPEDIDO)
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = (From rec In bd.DETALLEPEDIDO
                          Where rec.PEDIDO = zId
                          Select rec).ToList
                Return query
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
    Public Shared Function ListByItem(ByVal zId As Long) As List(Of DETALLEPEDIDO)
        Try
            Using bd As New gas_gasdesuvecinoEntities
                Dim query = (From rec In bd.DETALLEPEDIDO
                          Where rec.ITEM = zId
                          Select rec).ToList
                Return query
            End Using
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
End Class
